package chap09;

import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class TCP_Socket {
    public static void main(String []args) throws  Exception{
        ServerSocket ServerSocket= new ServerSocket(8888);//在端口中开启任务
        Socket socket=null;//等待接受的线程
        socket=ServerSocket.accept();
        OutputStream out =socket.getOutputStream();
        PrintWriter printWriter=new PrintWriter(out);//输出流
            printWriter.println("输出 这是服务端输出给你");
            printWriter.println("输出 这是服务端输出给你2");
            printWriter.close();
            out.close();;
            socket.close();;
            ServerSocket.close();
    }
}
